package com.sdutcm.Mapper;

/*
 *@Author Yan
 *@Create 2019-08-20 19:19
 */

import com.sdutcm.Domain.Lend;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface LendMapper {
    // 添加记录
    @Insert("INSERT INTO lend(l_person,l_manager,l_label) VALUES (#{l_person}, #{l_manager}, #{l_label})")
    public void lendAdd(Lend lend) throws Exception;

    // 查看当前记录
    @Select("select * from lend where l_end is null")
    public List<Lend> lendList() throws Exception;

    // 查看所有记录
    @Select("select * from lend")
    List<Lend> lendListHis() throws Exception;

    // 修改归还时间
    @Select("select * from lend where l_id = #{id}")
    public Lend listEdit(Integer id) throws Exception;

    @Update("UPDATE lend SET l_end = now(), l_label = #{l_label} WHERE l_id = #{l_id}")
    void lendEditTime(Lend lend)throws Exception;


}
